<template>
    <div class="container">
      <div id="map"></div>
    </div>
  </template>
  
  <script>
  import "mapbox-gl/dist/mapbox-gl.css";
  import mapboxgl from "mapbox-gl"; // or "const mapboxgl = require('mapbox-gl');"

  import CustomLayer from '../utils/CustomLayer'
  export default {
    name: "Vue2MapboxMapTemplate",
    data() {
      return {};
    },
  
    mounted() {
      this.initMap();
    },
  
    methods: {
      initMap() {
        mapboxgl.accessToken =
          "pk.eyJ1IjoiY3Vpaml5aW5nIiwiYSI6ImNsZ3QyZjY4ODAxbDEza3BkOTJqbTJvN3gifQ.Ldj9qAFzb5uzcLP-VtFB3A";
        const map = new mapboxgl.Map({
          container: "map",
          style: "mapbox://styles/cuijiying/cll09l2nz007w01picbmj3e1z",
          center: [118.79013542048335, 32.05775855185749], 
          zoom: 4, 
          projection: "mercator",
        });

        map.on('load', () => {
          const layer = new CustomLayer()
          map.addLayer(layer);

          console.log(layer);

          // setTimeout(()=>{
          //   layer.clear()
          // }, 3000)
        });





  
      },
    },
  };
  </script>
  
  <style></style>
  